package edu.uc.labs.MobilePrinting.Prefs;

public class Preferences {

	public Preferences(){
		
	}
	
	/**
	 * Setter for startAtLogin
	 * @param setParam string representation of 1 or 0 (true or false)
	 */
	public void setStartAtLogin( String setParam ){
		this.startAtLogin = setParam.equals("0") ? false : true;
	}

	/**
	 * Getter for startAtLogin
	 * @return true if startAtLogin is set
	 */
	public boolean isStartAtLogin() {
		return startAtLogin;
	}
	
	/**
	 * Setter for deleteOnExit
	 * @param setParam string representation of 1 or 0 (true or false)
	 */
	public void setDeleteOnExit( String setParam ) {
		this.deleteOnExit = setParam.equals("0") ? false : true;
	}
	
	/**
	 * Getter for deleteOnExit
	 * @return true if deleteOnExit is set
	 */
	public boolean isDeleteOnExit() {
		return deleteOnExit;
	}
	
	/**
	 * @return the autoUpdate
	 */
	public boolean isAutoUpdate() {
		return autoUpdate;
	}

	/**
	 * @param autoUpdate the autoUpdate to set
	 */
	public void setAutoUpdate( String autoUpdate) {
		this.autoUpdate = autoUpdate.equals("0") ? false : true;
	}

	/**
	 * @return the sendUsage
	 */
	public boolean isSendUsage() {
		return sendUsage;
	}

	/**
	 * @param sendUsage the sendUsage to set
	 */
	public void setSendUsage( String sendUsage ) {
		this.sendUsage = sendUsage.equals("0") ? false : true;
	}

	/**
	 * @return the configServer
	 */
	public String getConfigServer() {
		return configServer;
	}

	/**
	 * @param configServer the configServer to set
	 */
	public void setConfigServer(String configServer) {
		this.configServer = configServer;
	}

	/**
	 * @return the printerName
	 */
	public String getPrinterName() {
		return printerName;
	}

	/**
	 * @param printerName the printerName to set
	 */
	public void setPrinterName(String printerName) {
		this.printerName = printerName;
	}

	/**
	 * @return the logLevel
	 */
	public String getLogLevel() {
		return logLevel;
	}

	/**
	 * @param logLevel the logLevel to set
	 */
	public void setLogLevel(String logLevel) {
		this.logLevel = logLevel;
	}
	
	public String toString(){
		
		return ("\n\nStart at Login:  " + booleanToString(startAtLogin) + "\n" +
				"Delete on Exit:  " + booleanToString(deleteOnExit) + "\n" +
				"Auto Update:     " + booleanToString(autoUpdate)   + "\n" +
				"Send Usage Data: " + booleanToString(sendUsage) + "\n" +
				"========================\n" +
				"Configuration Server: " + configServer + "\n" +
				"Printer Name:         " + printerName  + "\n" +
				"Log Level:			   " + logLevel		+ "\n" ); 
	}

	private String booleanToString( boolean test ) {
		if(test){
			return "True";
		} else {
			return "False";
		}
	}
	
	// Variable Declaration 
	private boolean startAtLogin;
	private boolean deleteOnExit;
	private boolean autoUpdate;
	private boolean sendUsage;
	private String configServer;
	private String printerName;
	private String logLevel;


}
